package com.hzlj.position.locate.controller.notify;


import com.fz.common.base.core.JsonUtils;
import com.fz.common.base.dto.ResultDTO;
import com.hzlj.common.message.common.dto.message.MessageNotifyDTO;
import com.hzlj.position.locate.service.PositionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 核验通知结果通知接口
 */
@Slf4j
@RestController
@RequestMapping("/position/locate/message/notify")
public class PositionNotifyController {
    @Resource
    private PositionService positionService;

    /**
     * 单个外呼结果回调
     */
    @PostMapping("/{positionId}")
    public ResultDTO<String> singleCallResult(@PathVariable("positionId") String positionId,
                                              @RequestBody MessageNotifyDTO notify) {

        log.info("【定位】收到消息回调:{}", JsonUtils.obj2json(notify));
        Map<String, Object> map = JsonUtils.json2map(notify.getExt().getParams());
        String positionTime = (String) map.get("positionTime");
        notify.getExt().setParams(null);
        return ResultDTO.ok();
    }

}

